package com.ljx.thread.thread01;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/10/31 15:10
 * @Version 1.0
 */
public class BoyThread implements Runnable{
	private Card card;
	public BoyThread(Card card){
		this.card=card;
	}

	@Override
	public void run() {
		synchronized (card){
		for (int i = 0; i < 10; i++) {
			card.setBalance(1000+card.getBalance());
			System.out.println(Thread.currentThread().getName()+"向银行存了1000 余额为"+card.getBalance());
		}
		}
	}
}
